import 'dart:async';

import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/cupertino.dart';
import 'package:mahjong/const/LocationEnum.dart';
import 'package:mahjong/entity/user/UserLocation.dart';
import 'package:mahjong/notify/MahjongUserNotify.dart';

final GlobalKey<NavigatorState> navigatorKey = new GlobalKey<NavigatorState>();

final Map<String, MahjongUserNotify> diskPartUserProvider = {};
final Map<String, UserLocation> userLocation = {};
final AudioCache audioCache = AudioCache();
final AudioPlayer audioPlayer = AudioPlayer();

final List<String> soundMessageArray = [
  "不要吵了，不要吵了，吵啥嘛吵，专心玩游戏把。",
  "不要走，决战到天亮啊。",
  "大家好很高兴见到各位。",
  "诶，各位不好意思啊，我得离开一会儿。",
  "和你合作真是太愉快了啊。",
  "快点啊都等得我花儿都谢了。",
  "您的牌打的也挺好的啊。",
  "你是妹妹还是哥哥啊。",
  "咋交个朋友吧，能告诉我你怎么联系的嘛。",
  "下次咋们再玩把，我会想念大家的。",
  "再见了我会想念大家的。",
  "怎么又断线了，网络怎么这么差啊。"
];

StreamController diceStreamController;

StreamController exchangeCardStreamController;

class RoomState {
  RoomState._();
  // 开始了
  static const int START = 1;
  // 创建
  static const int CREATE = 0;
  // 结束
  static const int OVER = 2;
  // 账单清算状态
  static const int BILL_CLEARING = 3;
  // 换三张状态
  static const int CHANGE = 4;
}

class CardEnum {
  CardEnum._();
  // 暗杠  明杠  点杠
  static const String TOUCH = "TOUCH";
  static const String ANGANG = "ANGANG";
  static const String MINGGANG = "MINGGANG";
  static const String DIANGANG = "DIANGANG";
  // 庄家棋牌数量
  static const int BANKER_COUNT = 14;
  // 闲家棋牌数量
  static const int LEISURE_COUNT = 13;
}

enum UserPosition { LEFT, RIGHT, TOP, BOTTOM }

class UserActionConst {
  static final String OFF_LINE = "OFF_LINE";
  static final String ON_LINE = "ON_LINE";
}

class RoomDissolutionConst {
  RoomDissolutionConst._();
  //  已同意
  static final int agree = 1;
  // 已拒绝
  static final int refuse = 2;
  // 待处理
  static final int dvlue = 0;
}

class MessageTypeConst {
  MessageTypeConst._();
  //  已同意
  static final int sound = 1;
  // 已拒绝
  static final int chart = 2;
  // 待处理
  static final int emoji = 3;
}

class MessageAction {
  MessageAction._();
  // 麻将的行为
  static const String ADD_HOME = "ADD_HOME";
  // 用户准备 prepare
  static const String USER_PREPARE = "USER_PREPARE";

  // 退出
  static const String LOG_OUT = "LOG_OUT";
  // 解散
  static final String DISSOLUTION = "DISSOLUTION";

  static final String INTERACTIVE = "INTERACTIVE";

  static const String READ_HOME = "READ_HOME";
  // 摇骰子
  static const String DISK_DICE = "DISK_DICE";

  // 游戏结束
  static const String CURRENT_GAME_OVER = "CURRENT_GAME_OVER";

  // 收牌
  static const String ACCEPT_DICE = "ACCEPT_DICE";
  // 交换牌指令
  static const String EXCHANGE_CARD = "EXCHANGE_CARD";
  // 出牌指令
  static const String EXPORT_CARD = "EXPORT_CARD";
  // 摸   碰   杠   胡  过
  // 报叫
  static const String CARD_CALL = "CARD_CALL";
  // 碰牌

  static const String CARD_TOUCH = "CARD_TOUCH";
  // 杠牌
  static const String CARD_BAR = "CARD_BAR";

  // 发牌
  static const String CARD_LICENSING = "CARD_LICENSING";

  // 胡牌
  static const String CARD_HU = "CARD_HU";

  // 过
  static const String ACTION_PASS = "ACTION_PASS";

  // message Tips
  static const String ACTION_TIPS = "ACTION_TIPS";

  static final String USER_UPDATE = "USER_UPDATE";
}
